package com.cn.zy.hr.redis.controller;

import com.cn.zy.hr.redis.entity.UserInfoEntity;
import com.cn.zy.hr.redis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhangyi
 * @date 2018/11/28 18:50
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private UserService userService;

    @GetMapping("/findAll")
    public List<UserInfoEntity> getAll(){
        return userService.findAll();
    }

    @GetMapping("/update")
    public UserInfoEntity update(UserInfoEntity userInfoEntity){
        return userService.updateUser(userInfoEntity);
    }
    @GetMapping("/find/{id}")
    public UserInfoEntity getUser(@PathVariable("id") Long id){
        return userService.getUser(id);
    }

}
